package service;

import entities.*;

import java.util.List;

/**
 * Facilitates database transactions.
 */
public interface LollaService {

	/**
	 * Returns a LollaObject with the given name and class.
	 */
	LollaObject getByName(String name, Class<? extends LollaObject> type);

	/**
	 * Returns a LollaObject with the given id and class.
	 */
	LollaObject getById(long id, Class<? extends LollaObject> type);

	/**
	 * Returns a List of LollaObjects of the given class.
	 */
	List<? extends LollaObject> getAllByType(Class<? extends LollaObject> type);

	/**
	 * Returns the number of rows for the given class.
	 */
	long countType(Class<? extends LollaObject> type);

	/**
	 * Returns a List of Events with respect to the given Band.
	 */
	List<Event> getEventsByBand(Band band);

	/**
	 * Returns a List of Bands with respect to the given Event.
	 */
	List<Band> getBandsByEvent(Event event);

	/**
	 * Returns a List of Events with respect to the given Venue.
	 */
	List<Event> getEventsByVenue(Venue venue);

	/**
	 * Returns the Venue specified by the given Event.
	 */
	Venue getVenueByEvent(Event event);

	/**
	 * Saves a LollaObject to the database.
	 */
	void save(LollaObject entity);
	
	/**
	 * Saves or updates a LollaObject.
	 */
	void saveOrUpdate(LollaObject entity);
	
	/**
	 * Saves or updates a List of LollaObjects.
	 */
	void saveOrUpdateAll(List<LollaObject> objects);

	/**
	 * Saves all LollaObjects to the database.
	 */
	void saveAll();

	/**
	 * Processes the given Update.
	 */
	void update(Update update);

	/**
	 * Processes the List of given Updates.
	 */
	void updateAll(List<Update> updates);

	/**
	 * Adds the given Band to the user's schedule.
	 */
	long addBandToMySchedule(Band band);

	/**
	 * Removes the given Band from the user's schedule.
	 */
	void removeBandFromMySchedule(Band band);

	/**
	 * Retrieves all Bands from the user's schedule.
	 */
	List<Band> getAllBandsFromMySchedule();
	
	
	void buildAndSaveImages();

}
